#ifndef LOGIC_ADD_H
#define LOGIC_ADD_H

#include <iostream>
#include <string>
#include <vector>

#include "Parser.h"
#include "Data.h"
#include "Task.h"
#include "Writer.h"

#include <boost\date_time.hpp>

using namespace std;
using namespace boost::posix_time;
using namespace boost::gregorian;

class LogicAdd {
private:
	enum ErrorAdd {
		NO_ERROR,
		ERROR_DATE_PAST,
		ERROR_START_END
	};

public:
	
	string addFloatingTask(Parser::PARSED_COMMAND parsedCommand, 
							vector<Task>& tasksVector, 
							Data* _data, 
							Writer* _writer);

	string addDeadlineTask(Parser::PARSED_COMMAND parsedCommand, 
							vector<Task>& tasksVector, 
							Data* _data, 
							Writer* _writer);

	string addTimedTask(Parser::PARSED_COMMAND parsedCommand, 
							vector<Task>& tasksVector, 
							Data* _data, 
							Writer* _writer);

private:

	Task _task;

	static const string ADD_SUCCESS_MESSAGE;

	static const string ADD_ERROR_MESSAGE;
	static const string ADD_EXIST_ERROR_MESSAGE;
	static const string ADD_ERROR_CLASH_MESSAGE;
	static const string ADD_DATE_PAST_ERROR_MESSAGE;
	static const string ADD_DATE_START_END_ERROR_MESSAGE;

	bool isOutOfBounds(int index, int size);

	ErrorAdd isDateCorrectFormat(ptime startTime, ptime endTime);

	bool isDateClash(Parser::PARSED_COMMAND parsedCommand, 
							vector<Task>& tasksVector, 
							Data* _data);
};
#endif